/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package parser;

import java.io.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;
/**
 *
 * @author ayca
 */
public class HTMLParser {

    public HTMLParser() {
    }

   public static String ClearHTMLTags(String strHTML, int intWorkFlow){
        Pattern pattern = null;
	    Matcher matcher = null;
	   	String regex;
	   	String strTagLess = null;
    	strTagLess = strHTML;

    	if(intWorkFlow == -1)
  		{
  			regex = "<[^>]*>";
  			//removes all html tags
			pattern = pattern.compile(regex);
			strTagLess = pattern.matcher(strTagLess).replaceAll(" ");
		}

		if(intWorkFlow > 0 && intWorkFlow < 3)
		{

		  	regex = "[<]";
			//matches a single <
			pattern = pattern.compile(regex);
			strTagLess = pattern.matcher(strTagLess).replaceAll("<");

			regex = "[>]";
			//matches a single >
		 	pattern = pattern.compile(regex);
			strTagLess = pattern.matcher(strTagLess).replaceAll(">");
		}
		return strTagLess;

    }

}
